<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>智投内容页</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/styleold.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeWin(){
            api.closeWin({
            });
        };
    </script>
</head>
<body>
    <div id="list">
        <!-- 头部 -->
        <header class="aui-bar aui-bar-nav">
            <a class="aui-pull-left aui-btn" onclick="closeWin()">
                <span class="aui-iconfont aui-icon-left"></span>
            </a>
            <div class="aui-title">-</div>
        </header>
        <!-- 智投内容 -->
        <div class="licai-zhitou-t">
            <p>预期年化利率(%)</p>
            -
            <p><span class="fa fa-address-book-o"></span>已有<i>-</i>人购买<span class="fa fa-angle-right"></span></p>
            <ul>
                <li><p class="money">-</p>可投金额(元)</li>
                <li><p class="money">-</p>起投金额(元)</li>
                <li><p>-</p>项目期限(月)</li>
            </ul>
        </div>
        <div class="licai-zhitou-m">
            <ul>
                <li>
                    <span class="fa fa-file-text-o"></span>
                    <p>购买成功</p>
                </li>
                <li>
                    <span class="fa fa-sitemap"></span>
                    <p>自动匹配项目</p>
                </li>
                <li>
                    <span class="fa fa-thumbs-o-up"></span>
                    <p>坐等收益</p>
                </li>
                <div class="licai-zhitou-m-s1"></div>
                <div class="licai-zhitou-m-s2"></div>
            </ul>
        </div>
        <div class="aui-content aui-margin-t-15">
            <ul class="aui-list aui-list-in">
                <li class="aui-list-item aui-list-item-middle">
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-title">产品详情</div>
                    </div>
                </li>
                <li class="aui-list-item aui-list-item-middle">
                    <div class="aui-list-item-inner aui-list-item-arrow" onclick="question();">
                        <div class="aui-list-item-title">常见问题</div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="licai-record-d" id="kegoumai" style="display: none;" onclick="kegoumai();">立即购买</div>
    </div>
</body>
<script type="text/template" id="template">
    <!-- 头部 -->
    <header class="aui-bar aui-bar-nav">
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">{{=it.learn_info.name}}</div>
    </header>
    <!-- 智投内容 -->
    <div class="licai-zhitou-t">
        <p>预期年化利率(%)</p>
        {{=it.learn_info.rate}}
        <p onclick="buy_people({{=it.time_limit}})"><span class="fa fa-address-book-o"></span>已有<i>{{=it.learn_info.buy_count}}</i>人购买<span class="fa fa-angle-right"></span></p>
        <ul>
            <li><p class="money">{{=it.learn_balance}}</p>可投金额(元)</li>
            <li><p class="money">{{=it.learn_balance}}</p>起投金额(元)</li>
            <li><p>{{=it.learn_info.time_limit}}</p>项目期限(月)</li>
        </ul>
    </div>
    <div class="licai-zhitou-m">
        <ul>
            <li>
                <span class="fa fa-file-text-o"></span>
                <p>购买成功</p>
            </li>
            <li>
                <span class="fa fa-sitemap"></span>
                <p>自动匹配项目</p>
            </li>
            <li>
                <span class="fa fa-thumbs-o-up"></span>
                <p>坐等收益</p>
            </li>
            <div class="licai-zhitou-m-s1"></div>
            <div class="licai-zhitou-m-s2"></div>
        </ul>
    </div>
    <div class="aui-content aui-margin-t-15">
        <ul class="aui-list aui-list-in">
            <li class="aui-list-item aui-list-item-middle">
                <div class="aui-list-item-inner aui-list-item-arrow" onclick="product();">
                    <div class="aui-list-item-title">产品详情</div>
                </div>
            </li>
            <li class="aui-list-item aui-list-item-middle">
                <div class="aui-list-item-inner aui-list-item-arrow" onclick="question();">
                    <div class="aui-list-item-title">常见问题</div>
                </div>
            </li>
        </ul>
    </div>
    <div class="licai-record-d" id="kegoumai" onclick="once_buy();">立即购买</div>
</script>
<script type="text/javascript">
    // var load_count = '';
    // var min_money_format_num = '';
    // var borrow_amount = '';
    // var rate = '';
    // var time_limit = '';

    apiready = function(){
        learn_info = api.pageParam.learn_info;
        templateFun(learn_info);
        productID = learn_info.learn_info.id;
        borrow_amount = learn_info.learn_balance;
        // id = api.pageParam.id;
        // alert(id);
        // load_list(id);
        // addOb();
    }

    // function addOb() {
    //     api.addEventListener({
    //         name: 'login_success'
    //     }, function(ret, err){
    //         if( ret ){
    //            load_list(id);
    //        }else{
    //            // alert( JSON.stringify( err ) );
    //        }
    //    });
    // }


    function templateFun(data){

      var template = $api.byId('template');
      var dotFn = doT.template(template.innerHTML);
      var html = dotFn(data);
      var user = $api.byId('list');
      $api.html(user, html);
  }

    // 已购人数
    function buy_people(id) {
        // api.openWin({
        //     name: 'licai_record_zhitou',
        //     url: './licai-record-zhitou.html',
        //     pageParam: {
        //         id: id,
        //         load_count:load_count,
        //     }
        // });
    }

    function product(){
        api.openWin({
            name: 'licai-chanpinxiangqing-2',
            url: './licai-chanpinxiangqing-2.html',
            pageParam: {
                productID: productID
            }
        });
    }

    // 可购买
    function once_buy() {

        if (borrow_amount == 0) {
            api.toast({
                msg: '没有可投金额，无法购买',
                duration: 2000,
                location: 'bottom'
            });
            return false;
        }

        api.openWin({
            name: 'licai-buy-yuebao-2',
            url: './licai-buy-yuebao-2.html',
            pageParam: {
                learn_info:learn_info,
            }
        });
    }

    function question(){
        api.openWin({
            name: 'ques-list',
            url: './ques-list.html',
            pageParam: {
                name: 'test'
            }
        });
    }

    function closeBank(){
      api.closeFrame({
        name: 'bank'
    });
  }

</script>
</html>